﻿using CompanyManageSystem.DLL;
using CompanyManageSystem.Model;
using CompanyManageSystem.Service;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace CompanyManageSystem.UI.Main
{
    public partial class Frm_ModifyPsw : BaseXtraForm
    {
        #region 属性
        public Guid ID { get; set; }
        #endregion

        /// <summary>
        /// 构造方法
        /// </summary>
        public Frm_ModifyPsw(Guid id)
        {
            InitializeComponent();
            this.ID = id;
        }

        /// <summary>
        /// 窗体加载完成
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Frm_ModifyPsw_Load(object sender, EventArgs e)
        {
            AppService aservice = new AppService();

            EditPast.Text = aservice.GetPasswordByID(ID);
        }

        /// <summary>
        /// 确定
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Btn_OK_Click(object sender, EventArgs e)
        {
            AppService aservice = new AppService();
            Login login = aservice.UpdatePassword(ID,this.EditNew.Text);
            this.Hide();
            MessageBox.Show("更新成功!");
            this.Close();
        }

        /// <summary>
        /// 取消
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Btn_Cancle_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        
    }
}
